#include <iostream>

using namespace std;
/*
14-14:
Create two classes called Traveler and Pager without default constructors, 
but with constructors that take an argument of type string, 
which they simply copy to an internal string variable. 
	
For each class, write the correct copy-constructor and assignment operator. 
	
Now inherit a class BusinessTraveler from Traveler and give it a member object of type Pager. 
	
Write the correct default constructor, a constructor that takes a string argument, a copy-constructor, and an assignment operator.
*/
class Traveler{
public:
	string str;
	
	Traveler(string str):str(str){
		cout << "the constructor that take an argument of type string of Traveler is called." << endl;
	}
	
	Traveler(Traveler& t){
		this->str = t.str;
		cout << "the copy-constructor of Traveler is called." << endl;
	}
	
	Traveler& operator=(Traveler& t){
		this->str = t.str;
		cout << "the assignment operator of Traveler is called." << endl;
	}
};

class Pager{
public:
	string str;
	
	Pager(string str):str(str){
		cout << "the constructor that take an argument of type string of Pager is called." << endl;
	}
	
	Pager(Pager& p){
		this->str = p.str;
		cout << "the copy-constructor of Pager is called." << endl;
	}
	
	Pager& operator=(Pager& p){
		this->str = p.str;
		cout << "the assignment operator of Pager is called." << endl;
	}

};

class BusinessTraveler: public Traveler{
public:
	Pager p;
	
	BusinessTraveler():p("a"), Traveler("b") {
		cout << "the defaulted constructor of BusinessTraveler is called." << endl;
	}
	
	BusinessTraveler(string str):p(str), Traveler(str){
		cout << "the constructor that take an argument of type string of BusinessTraveler is called." << endl;
	}
	
	BusinessTraveler(BusinessTraveler& b):p(b.p), Traveler(b){
		cout << "the copy-constructor of BusinessTraveler is called." << endl;
	}
	
	BusinessTraveler& operator=(BusinessTraveler& b){
		p = b.p;
		cout << "the assignment operator of BusinessTraveler is called." << endl;
	}
	
};

int main(int argc, char *argv[]) {
	BusinessTraveler b1;
	cout << "=====================================" << endl;
	BusinessTraveler b2("zxy");
	cout << "=====================================" << endl;
	BusinessTraveler b3(b1);
	cout << "=====================================" << endl;
	BusinessTraveler b4 = b1;
}